home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8402 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1001 b   |  39 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.dcs.warwick.ac.uk!not-for-mail
  3. From: D.C.Molero@dcs.warwick.ac.uk (Daniel Castillo Molero)
  4. Subject: strange behaviour of doubles
  5. X-Nntp-Posting-Host: star
  6. Message-ID: <1996Mar4.014052.6236@dcs.warwick.ac.uk>
  7. Sender: news@dcs.warwick.ac.uk (Network News)
  8. Organization: Department of Computer Science, Warwick University, England
  9. Date: Mon, 4 Mar 1996 01:40:52 GMT
  10.  
  11.  
  12. Dear readers,
  13. Can anybody explain to me why the behaviour of the following little
  14. program is not the expected one ??
  15. It is supposed to read from std input pairs of doubles and print them,
  16. until 0.0 is input.
  17. The strange thing is that it doesn't print the input number, e.g. when
  18. I input 1.0 1.0   it prints   0.0078125  0.0078125
  19. I will appreciate very much any help.
  20.  
  21.  
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24.  
  25. main() {
  26. double x, y;
  27. scanf("%g", &x);
  28. while (x != 0.0) {
  29.   scanf("%g", &y);
  30.   printf("%g %g\n", x, y);
  31.   scanf("%g", &x);
  32. }
  33. return(0);
  34. }
  35. -- 
  36. * Daniel Castillo.  danmol@dcs.warwick.ac.uk *
  37.  
  38.  
  39.